<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>RocketMQ消费者模式深度解析</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            line-height: 1.8;
            color: #333;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%);
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0,0,0,0.1);
        }
        .highlight-box {
            position: relative;
        }
        .highlight-box:before {
            content: '';
            position: absolute;
            left: -8px;
            top: 0;
            height: 100%;
            width: 4px;
            background: linear-gradient(to bottom, #6e8efb, #a777e3);
            border-radius: 2px;
        }
        .content-anchor {
            scroll-margin-top: 120px;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 md:py-32 px-4 md:px-0">
        <div class="container mx-auto max-w-5xl px-6">
            <div class="text-center">
                <h1 class="text-4xl md:text-6xl font-bold mb-6 leading-tight">RocketMQ消费者模式</h1>
                <p class="text-xl md:text-2xl opacity-90 max-w-3xl mx-auto">深度解析Push与Pull模式的工作原理、核心特点及适用场景</p>
                <div class="mt-12 flex flex-wrap justify-center gap-4">
                    <a href="#push-mode" class="px-6 py-3 bg-white text-indigo-700 font-medium rounded-full hover:bg-opacity-90 transition-all duration-300 shadow-lg">Push模式详解</a>
                    <a href="#pull-mode" class="px-6 py-3 bg-indigo-700 bg-opacity-30 text-white font-medium rounded-full hover:bg-opacity-40 transition-all duration-300 shadow-lg">Pull模式详解</a>
                    <a href="#comparison" class="px-6 py-3 bg-indigo-700 bg-opacity-30 text-white font-medium rounded-full hover:bg-opacity-40 transition-all duration-300 shadow-lg">模式对比</a>
                </div>
            </div>
        </div>
    </section>

    <!-- Navigation -->
    <nav class="sticky top-0 bg-white shadow-sm z-10">
        <div class="container mx-auto px-4">
            <div class="flex justify-center">
                <div class="flex space-x-1 md:space-x-4 py-4 overflow-x-auto">
                    <a href="#push-mode" class="px-3 py-2 text-sm font-medium text-gray-700 hover:text-indigo-600 whitespace-nowrap">Push模式</a>
                    <a href="#pull-mode" class="px-3 py-2 text-sm font-medium text-gray-700 hover:text-indigo-600 whitespace-nowrap">Pull模式</a>
                    <a href="#comparison" class="px-3 py-2 text-sm font-medium text-gray-700 hover:text-indigo-600 whitespace-nowrap">模式对比</a>
                    <a href="#scenarios" class="px-3 py-2 text-sm font-medium text-gray-700 hover:text-indigo-600 whitespace-nowrap">适用场景</a>
                    <a href="#best-practices" class="px-3 py-2 text-sm font-medium text-gray-700 hover:text-indigo-600 whitespace-nowrap">最佳实践</a>
                </div>
            </div>
        </div>
    </nav>

    <!-- Main Content -->
    <main class="container mx-auto max-w-5xl px-4 md:px-6 py-12">
        <!-- Push Mode Section -->
        <section id="push-mode" class="mb-20 content-anchor">
            <div class="flex items-center mb-8">
                <div class="bg-indigo-100 w-12 h-12 rounded-full flex items-center justify-center mr-4">
                    <i class="fas fa-paper-plane text-indigo-600 text-xl"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">Push模式的工作原理和特点</h2>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="bg-white p-6 rounded-xl shadow-md card-hover transition-all duration-300">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-700 flex items-center">
                        <i class="fas fa-info-circle mr-2"></i> Push模式基本概念
                    </h3>
                    <p class="text-gray-700">Push模式是RocketMQ消费者的默认工作模式，尽管名为"推模式"，其实际实现是基于长轮询(Long Polling)机制，在Consumer端主动拉取消息的基础上模拟了服务端推送的效果。</p>
                </div>
                
                <div class="bg-white p-6 rounded-xl shadow-md card-hover transition-all duration-300">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-700 flex items-center">
                        <i class="fas fa-project-diagram mr-2"></i> Push模式流程图
                    </h3>
                    <div class="mermaid">
                        graph TD
                            A[Consumer启动] --> B[注册订阅信息]
                            B --> C[指定Topic/Tag过滤条件]
                            B --> D[注册消息监听器]
                            C --> E[长轮询拉取消息]
                            D --> E
                            E --> F{有消息?}
                            F -->|是| G[返回消息]
                            F -->|否| H[挂起请求15秒]
                            H --> I{新消息到达?}
                            I -->|是| G
                            I -->|否| J[返回空结果]
                            J --> E
                            G --> K[提交到消费线程池]
                            K --> L[调用MessageListener]
                            L --> M[确认消费位点]
                    </div>
                </div>
            </div>
            
            <div class="mb-12">
                <h3 class="text-2xl font-semibold mb-6 text-gray-800 border-b pb-2 flex items-center">
                    <i class="fas fa-list-ol mr-3 text-indigo-600"></i> Push模式的工作流程
                </h3>
                <div class="space-y-6">
                    <div class="highlight-box pl-8 pr-6 py-4 bg-white rounded-lg shadow-sm">
                        <h4 class="font-bold text-lg text-indigo-700 mb-2">1. 订阅注册</h4>
                        <ul class="list-disc pl-5 space-y-2 text-gray-700">
                            <li>消费者启动时向Consumer服务器注册订阅信息</li>
                            <li>指定Topic和Tag过滤条件</li>
                            <li>注册消息监听器(MessageListener)实现消费逻辑</li>
                        </ul>
                    </div>
                    
                    <div class="highlight-box pl-8 pr-6 py-4 bg-white rounded-lg shadow-sm">
                        <h4 class="font-bold text-lg text-indigo-700 mb-2">2. 长轮询拉取</h4>
                        <ul class="list-disc pl-5 space-y-2 text-gray-700">
                            <li>Consumer内部的拉取线程向Broker发送拉取请求</li>
                            <li>如果Broker有可消费消息，立即返回给Consumer</li>
                            <li>如果没有消息，Broker会挂起请求一段时间(默认15秒)</li>
                            <li>在挂起期间，若有新消息到达，立即返回给Consumer</li>
                            <li>超时后返回空结果，Consumer会立即发起下一次拉取请求</li>
                        </ul>
                    </div>
                    
                    <div class="highlight-box pl-8 pr-6 py-4 bg-white rounded-lg shadow-sm">
                        <h4 class="font-bold text-lg text-indigo-700 mb-2">3. 消息消费</h4>
                        <ul class="list-disc pl-5 space-y-2 text-gray-700">
                            <li>获取到消息后，将消息提交到消费线程池</li>
                            <li>消费线程调用用户注册的MessageListener处理消息</li>
                            <li>根据消费结果决定是否确认消费位点</li>
                        </ul>
                    </div>
                    
                    <div class="highlight-box pl-8 pr-6 py-4 bg-white rounded-lg shadow-sm">
                        <h4 class="font-bold text-lg text-indigo-700 mb-2">4. 位点提交</h4>
                        <ul class="list-disc pl-5 space-y-2 text-gray-700">
                            <li>消息消费成功后自动提交消费位点</li>
                            <li>异常情况下根据消费策略决定重试或跳过</li>
                        </ul>
                    </div>
                </div>
            </div>
            
            <div class="mb-12">
                <h3 class="text-2xl font-semibold mb-6 text-gray-800 border-b pb-2 flex items-center">
                    <i class="fas fa-star mr-3 text-indigo-600"></i> Push模式的核心特点
                </h3>
                <div class="grid md:grid-cols-2 gap-6">
                    <div class="bg-indigo-50 p-6 rounded-xl border-l-4 border-indigo-500">
                        <h4 class="font-bold text-lg text-indigo-700 mb-3 flex items-center">
                            <i class="fas fa-robot mr-2"></i> 自动化程度高
                        </h4>
                        <p class="text-gray-700">消息拉取、提交、重试等过程对用户透明，用户只需关注消息处理业务逻辑。</p>
                    </div>
                    
                    <div class="bg-indigo-50 p-6 rounded-xl border-l-4 border-indigo-500">
                        <h4 class="font-bold text-lg text-indigo-700 mb-3 flex items-center">
                            <i class="fas fa-bolt mr-2"></i> 实时性较好
                        </h4>
                        <p class="text-gray-700">长轮询机制确保新消息能够及时处理，消息到达后立即触发消费。</p>
                    </div>
                    
                    <div class="bg-indigo-50 p-6 rounded-xl border-l-4 border-indigo-500">
                        <h4 class="font-bold text-lg text-indigo-700 mb-3 flex items-center">
                            <i class="fas fa-balance-scale mr-2"></i> 系统负载自动平衡
                        </h4>
                        <p class="text-gray-700">根据消费能力自动调整拉取频率，消费者处理能力不足时会降低拉取频率。</p>
                    </div>
                    
                    <div class="bg-indigo-50 p-6 rounded-xl border-l-4 border-indigo-500">
                        <h4 class="font-bold text-lg text-indigo-700 mb-3 flex items-center">
                            <i class="fas fa-microchip mr-2"></i> 资源占用相对固定
                        </h4>
                        <p class="text-gray-700">长轮询连接常驻，占用连接资源，消费线程池预先创建，资源使用稳定。</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Pull Mode Section -->
        <section id="pull-mode" class="mb-20 content-anchor">
            <div class="flex items-center mb-8">
                <div class="bg-purple-100 w-12 h-12 rounded-full flex items-center justify-center mr-4">
                    <i class="fas fa-hand-paper text-purple-600 text-xl"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">Pull模式的执行流程和优势</h2>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="bg-white p-6 rounded-xl shadow-md card-hover transition-all duration-300">
                    <h3 class="text-xl font-semibold mb-4 text-purple-700 flex items-center">
                        <i class="fas fa-info-circle mr-2"></i> Pull模式基本概念
                    </h3>
                    <p class="text-gray-700">Pull模式是完全由应用主动控制的消费方式，Consumer应用显式调用拉取API获取消息，自主掌控消息的消费节奏和处理逻辑。</p>
                </div>
                
                <div class="bg-white p-6 rounded-xl shadow-md card-hover transition-all duration-300">
                    <h3 class="text-xl font-semibold mb-4 text-purple-700 flex items-center">
                        <i class="fas fa-project-diagram mr-2"></i> Pull模式流程图
                    </h3>
                    <div class="mermaid">
                        graph TD
                            A[创建Consumer实例] --> B[配置参数]
                            B --> C[获取Topic路由信息]
                            C --> D[初始化消费位点]
                            D --> E[显式调用pullMessage]
                            E --> F[指定Topic/队列/位点]
                            E --> G[设置批次大小]
                            E --> H[设置超时时间]
                            F --> I[处理拉取结果]
                            G --> I
                            H --> I
                            I --> J[解析消息]
                            J --> K[执行业务逻辑]
                            K --> L[更新消费位点]
                            L --> E
                    </div>
                </div>
            </div>
            
            <div class="mb-12">
                <h3 class="text-2xl font-semibold mb-6 text-gray-800 border-b pb-2 flex items-center">
                    <i class="fas fa-list-ol mr-3 text-purple-600"></i> Pull模式的执行流程
                </h3>
                <div class="space-y-6">
                    <div class="highlight-box pl-8 pr-6 py-4 bg-white rounded-lg shadow-sm">
                        <h4 class="font-bold text-lg text-purple-700 mb-2">1. 消费者初始化</h4>
                        <ul class="list-disc pl-5 space-y-2 text-gray-700">
                            <li>创建Consumer实例并配置</li>
                            <li>获取Topic的路由信息</li>
                            <li>初始化消费位点管理</li>
                        </ul>
                    </div>
                    
                    <div class="highlight-box pl-8 pr-6 py-4 bg-white rounded-lg shadow-sm">
                        <h4 class="font-bold text-lg text-purple-700 mb-2">2. 主动拉取消息</h4>
                        <ul class="list-disc pl-5 space-y-2 text-gray-700">
                            <li>应用代码显式调用pullMessage方法</li>
                            <li>指定Topic、队列、位点和批次大小</li>
                            <li>设置拉取超时时间</li>
                        </ul>
                    </div>
                    
                    <div class="highlight-box pl-8 pr-6 py-4 bg-white rounded-lg shadow-sm">
                        <h4 class="font-bold text-lg text-purple-700 mb-2">3. 消息处理</h4>
                        <ul class="list-disc pl-5 space-y-2 text-gray-700">
                            <li>应用自行处理拉取结果</li>
                            <li>解析消息并执行业务逻辑</li>
                            <li>维护下一次拉取的位点信息</li>
                        </ul>
                    </div>
                    
                    <div class="highlight-box pl-8 pr-6 py-4 bg-white rounded-lg shadow-sm">
                        <h4 class="font-bold text-lg text-purple-700 mb-2">4. 位点管理</h4>
                        <ul class="list-disc pl-5 space-y-2 text-gray-700">
                            <li>应用负责记录和更新消费位点</li>
                            <li>根据业务需要决定位点提交时机</li>
                            <li>可实现更灵活的位点控制策略</li>
                        </ul>
                    </div>
                </div>
            </div>
            
            <div class="mb-12">
                <h3 class="text-2xl font-semibold mb-6 text-gray-800 border-b pb-2 flex items-center">
                    <i class="fas fa-medal mr-3 text-purple-600"></i> Pull模式的核心优势
                </h3>
                <div class="grid md:grid-cols-2 gap-6">
                    <div class="bg-purple-50 p-6 rounded-xl border-l-4 border-purple-500">
                        <h4 class="font-bold text-lg text-purple-700 mb-3 flex items-center">
                            <i class="fas fa-sliders-h mr-2"></i> 完全自主控制
                        </h4>
                        <p class="text-gray-700">应用完全控制消息拉取节奏，可根据系统负载动态调整拉取频率和批次大小。</p>
                    </div>
                    
                    <div class="bg-purple-50 p-6 rounded-xl border-l-4 border-purple-500">
                        <h4 class="font-bold text-lg text-purple-700 mb-3 flex items-center">
                            <i class="fas fa-map-marker-alt mr-2"></i> 灵活的消费位点管理
                        </h4>
                        <p class="text-gray-700">支持自定义位点存储，可实现非常规的消费模式，如回溯消费。</p>
                    </div>
                    
                    <div class="bg-purple-50 p-6 rounded-xl border-l-4 border-purple-500">
                        <h4 class="font-bold text-lg text-purple-700 mb-3 flex items-center">
                            <i class="fas fa-tachometer-alt mr-2"></i> 资源高效利用
                        </h4>
                        <p class="text-gray-700">只在需要时创建连接和请求，可根据实际处理能力优化资源使用。</p>
                    </div>
                    
                    <div class="bg-purple-50 p-6 rounded-xl border-l-4 border-purple-500">
                        <h4 class="font-bold text-lg text-purple-700 mb-3 flex items-center">
                            <i class="fas fa-sitemap mr-2"></i> 适应复杂处理流程
                        </h4>
                        <p class="text-gray-700">支持消息批处理，可与其他系统流程集成和协调。</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Comparison Section -->
        <section id="comparison" class="mb-20 content-anchor">
            <div class="flex items-center mb-8">
                <div class="bg-teal-100 w-12 h-12 rounded-full flex items-center justify-center mr-4">
                    <i class="fas fa-balance-scale-left text-teal-600 text-xl"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">不同消费者模式的适用场景</h2>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="bg-white p-8 rounded-xl shadow-lg">
                    <div class="flex items-center mb-6">
                        <div class="bg-indigo-600 text-white w-10 h-10 rounded-full flex items-center justify-center mr-4">
                            <i class="fas fa-paper-plane"></i>
                        </div>
                        <h3 class="text-2xl font-bold text-indigo-700">Push模式适用场景</h3>
                    </div>
                    
                    <div class="space-y-4">
                        <div class="flex items-start">
                            <div class="bg-indigo-100 p-2 rounded-full mr-4 flex-shrink-0">
                                <i class="fas fa-clock text-indigo-600"></i>
                            </div>
                            <div>
                                <h4 class="font-semibold text-gray-800">实时性要求高的场景</h4>
                                <p class="text-gray-600">需要尽快处理新消息的业务，例如：实时通知、即时计算、告警系统</p>
                            </div>
                        </div>
                        
                        <div class="flex items-start">
                            <div class="bg-indigo-100 p-2 rounded-full mr-4 flex-shrink-0">
                                <i class="fas fa-bolt text-indigo-600"></i>
                            </div>
                            <div>
                                <h4 class="font-semibold text-gray-800">消息处理逻辑简单的场景</h4>
                                <p class="text-gray-600">消息处理流程相对独立，例如：简单的数据同步、状态更新、事件触发</p>
                            </div>
                        </div>
                        
                        <div class="flex items-start">
                            <div class="bg-indigo-100 p-2 rounded-full mr-4 flex-shrink-0">
                                <i class="fas fa-rocket text-indigo-600"></i>
                            </div>
                            <div>
                                <h4 class="font-semibold text-gray-800">开发便捷性优先的场景</h4>
                                <p class="text-gray-600">希望快速实现消息消费逻辑，例如：中小型应用、原型系统</p>
                            </div>
                        </div>
                        
                        <div class="flex items-start">
                            <div class="bg-indigo-100 p-2 rounded-full mr-4 flex-shrink-0">
                                <i class="fas fa-tachometer-alt text-indigo-600"></i>
                            </div>
                            <div>
                                <h4 class="font-semibold text-gray-800">稳定消费速率的场景</h4>
                                <p class="text-gray-600">消息处理时间相对稳定，例如：常规业务流程、标准化处理逻辑</p>
                            </div>
                        </div>
                        
                        <div class="flex items-start">
                            <div class="bg-indigo-100 p-2 rounded-full mr-4 flex-shrink-0">
                                <i class="fas fa-database text-indigo-600"></i>
                            </div>
                            <div>
                                <h4 class="font-semibold text-gray-800">消息量中等的场景</h4>
                                <p class="text-gray-600">消息量大但不至于导致系统负担过重，例如：一般业务系统的内部通知</p>
                            </div>
                        </div>
                    </div>
                </div>
                
                <div class="bg-white p-8 rounded-xl shadow-lg">
                    <div class="flex items-center mb-6">
                        <div class="bg-purple-600 text-white w-10 h-10 rounded-full flex items-center justify-center mr-4">
                            <i class="fas fa-hand-paper"></i>
                        </div>
                        <h3 class="text-2xl font-bold text-purple-700">Pull模式适用场景</h3>
                    </div>
                    
                    <div class="space-y-4">
                        <div class="flex items-start">
                            <div class="bg-purple-100 p-2 rounded-full mr-4 flex-shrink-0">
                                <i class="fas fa-boxes text-purple-600"></i>
                            </div>
                            <div>
                                <h4 class="font-semibold text-gray-800">批量处理优先的场景</h4>
                                <p class="text-gray-600">希望批量获取消息并进行处理，例如：数据分析、批量计算、ETL处理</p>
                            </div>
                        </div>
                        
                        <div class="flex items-start">
                            <div class="bg-purple-100 p-2 rounded-full mr-4 flex-shrink-0">
                                <i class="fas fa-microchip text-purple-600"></i>
                            </div>
                            <div>
                                <h4 class="font-semibold text-gray-800">系统资源敏感的场景</h4>
                                <p class="text-gray-600">需要精确控制资源使用，例如：资源有限的消费端、高负载系统</p>
                            </div>
                        </div>
                        
                        <div class="flex items-start">
                            <div class="bg-purple-100 p-2 rounded-full mr-4 flex-shrink-0">
                                <i class="fas fa-sliders-h text-purple-600"></i>
                            </div>
                            <div>
                                <h4 class="font-semibold text-gray-800">消费速率动态调整的场景</h4>
                                <p class="text-gray-600">需要根据系统负载动态调整消费速率，例如：弹性计算、负载敏感型应用</p>
                            </div>
                        </div>
                        
                        <div class="flex items-start">
                            <div class="bg-purple-100 p-2 rounded-full mr-4 flex-shrink-0">
                                <i class="fas fa-random text-purple-600"></i>
                            </div>
                            <div>
                                <h4 class="font-semibold text-gray-800">特殊消费模式的场景</h4>
                                <p class="text-gray-600">需要实现特殊的消费模式，例如：消息回溯、跳跃消费、定制重试逻辑</p>
                            </div>
                        </div>
                        
                        <div class="flex items-start">
                            <div class="bg-purple-100 p-2 rounded-full mr-4 flex-shrink-0">
                                <i class="fas fa-network-wired text-purple-600"></i>
                            </div>
                            <div>
                                <h4 class="font-semibold text-gray-800">与其他系统深度集成的场景</h4>
                                <p class="text-gray-600">消息消费与其他系统流程紧密关联，例如：复杂的工作流系统、事务性处理</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <div id="best-practices" class="bg-white p-8 rounded-xl shadow-lg mb-12 content-anchor">
                <div class="flex items-center mb-6">
                    <div class="bg-teal-600 text-white w-10 h-10 rounded-full flex items-center justify-center mr-4">
                        <i class="fas fa-lightbulb"></i>
                    </div>
                    <h3 class="text-2xl font-bold text-teal-700">选择指南与最佳实践</h3>
                </div>
                
                <div class="grid md:grid-cols-2 gap-6">
                    <div class="p-5 rounded-lg bg-teal-50 border-l-4 border-teal-500">
                        <h4 class="font-bold text-lg text-teal-700 mb-3 flex items-center">
                            <i class="fas fa-briefcase mr-2"></i> 基于业务特性选择模式
                        </h4>
                        <p class="text-gray-700">实时性要求高、处理逻辑简单 → Push模式<br>需要精细控制、批量处理、特殊消费逻辑 → Pull模式</p>
                    </div>
                    
                    <div class="p-5 rounded-lg bg-teal-50 border-l-4 border-teal-500">
                        <h4 class="font-bold text-lg text-teal-700 mb-3 flex items-center">
                            <i class="fas fa-server mr-2"></i> 考虑系统资源因素
                        </h4>
                        <p class="text-gray-700">消费端资源充足 → Push模式更便捷<br>资源受限或需精确控制 → Pull模式更高效</p>
                    </div>
                    
                    <div class="p-5 rounded-lg bg-teal-50 border-l-4 border-teal-500">
                        <h4 class="font-bold text-lg text-teal-700 mb-3 flex items-center">
                            <i class="fas fa-code mr-2"></i> 考虑开发维护成本
                        </h4>
                        <p class="text-gray-700">标准消费场景 → Push模式降低开发成本<br>特殊消费需求 → Pull模式虽复杂但更灵活</p>
                    </div>
                    
                    <div class="p-5 rounded-lg bg-teal-50 border-l-4 border-teal-500">
                        <h4 class="font-bold text-lg text-teal-700 mb-3 flex items-center">
                            <i class="fas fa-blender-phone mr-2"></i> 混合使用策略
                        </h4>
                        <p class="text-gray-700">同一系统中可对不同业务采用不同消费模式<br>核心业务可用Pull模式精确控制<br>一般业务可用Push模式简化开发</p>
                    </div>
                </div>
                
                <div class="mt-8 bg-blue-50 p-6 rounded-lg">
                    <h4 class="font-bold text-lg text-blue-700 mb-4 flex items-center">
                        <i class="fas fa-tools mr-2"></i> 通用优化建议
                    </h4>
                    <ul class="list-disc pl-5 space-y-2 text-gray-700">
                        <li>无论何种模式，合理设置消费线程池大小</li>
                        <li>适当配置批量消费参数提高效率</li>
                        <li>实现良好的异常处理和重试策略</li>
                    </ul>
                </div>
            </div>
            
            <div class="bg-white p-8 rounded-xl shadow-lg text-center">
                <div class="max-w-3xl mx-auto">
                    <p class="text-xl text-gray-700 mb-6">RocketMQ提供的两种消费模式满足了不同场景的需求，开发人员应根据业务特性和系统资源状况选择合适的消费模式，以获得最佳的系统性能和开发体验。</p>
                    <div class="w-20 h-1 bg-gradient-to-r from-indigo-500 to-purple-500 mx-auto mb-6"></div>
                    <p class="text-gray-500">技术小馆 · 消息中间件专家</p>
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-12">
        <div class="container mx-auto px-4 text-center">
            <div class="max-w-2xl mx-auto">
                <h3 class="text-xl font-bold text-white mb-4">技术小馆</h3>
                <p class="mb-6">深入解析技术原理，分享最佳实践</p>
                <div class="flex justify-center space-x-4">
                    <a href="http://www.yuque.com/jtostring" class="text-gray-400 hover:text-white transition-colors duration-300">
                        <i class="fas fa-globe text-lg"></i>
                        <span class="ml-2">技术小馆地址</span>
                    </a>
                </div>
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: false,
                htmlLabels: true,
                curve: 'basis'
            }
        });
        
        // 平滑滚动
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
    </script>
</body>
</html>